<?php

namespace frontend\models;

/**
 * @author  shuang
 * @date    2016-10-30 19:39:58
 * @version V1.0
 * @desc    
 */
use common\models\Grade;
use Yii;
use yii\db\Query;

class WB_Grade extends Grade {
    /*
     * 级别列表
     * @params $status
     * @params $title
     * return array
     */

    public static function getList() {
        $query = WB_Grade::find()->orderBy("created_at desc");
        $countQuery = clone $query;
        $pager = new \yii\data\Pagination(['totalCount' => $countQuery->count(), 'defaultPageSize' => 10]);
        $offset = Yii::$app->request->get("offset");
        $limit = Yii::$app->request->get("limit");
        $res = $query->offset($offset)->limit($limit)->asArray()->all();
        return ["pager" => $pager, "data" => $res];
    }


}
